/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ch.uzh.ifi.seal.ssqa.model.impl;

import ch.uzh.ifi.seal.ssqa.model.DiffReport;
import ch.uzh.ifi.seal.ssqa.model.ModelPackage;
import ch.uzh.ifi.seal.ssqa.model.Revision;
import ch.uzh.ifi.seal.ssqa.model.UcmActivity;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Revision</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.RevisionImpl#getRevisionFilePath <em>Revision File Path</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.RevisionImpl#getRevisionNumber <em>Revision Number</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.RevisionImpl#getDiffReport <em>Diff Report</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.RevisionImpl#getStream <em>Stream</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.RevisionImpl#getUcmActivity <em>Ucm Activity</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.RevisionImpl#getFilePath <em>File Path</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RevisionImpl extends EObjectImpl implements Revision {
	/**
	 * The default value of the '{@link #getRevisionFilePath() <em>Revision File Path</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRevisionFilePath()
	 * @generated
	 * @ordered
	 */
	protected static final String REVISION_FILE_PATH_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getRevisionFilePath() <em>Revision File Path</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRevisionFilePath()
	 * @generated
	 * @ordered
	 */
	protected String revisionFilePath = REVISION_FILE_PATH_EDEFAULT;

	/**
	 * The default value of the '{@link #getRevisionNumber() <em>Revision Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRevisionNumber()
	 * @generated
	 * @ordered
	 */
	protected static final int REVISION_NUMBER_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getRevisionNumber() <em>Revision Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRevisionNumber()
	 * @generated
	 * @ordered
	 */
	protected int revisionNumber = REVISION_NUMBER_EDEFAULT;

	/**
	 * The cached value of the '{@link #getDiffReport() <em>Diff Report</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDiffReport()
	 * @generated
	 * @ordered
	 */
	protected DiffReport diffReport;

	/**
	 * The default value of the '{@link #getStream() <em>Stream</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getStream()
	 * @generated
	 * @ordered
	 */
	protected static final String STREAM_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getStream() <em>Stream</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getStream()
	 * @generated
	 * @ordered
	 */
	protected String stream = STREAM_EDEFAULT;

	/**
	 * The cached value of the '{@link #getUcmActivity() <em>Ucm Activity</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUcmActivity()
	 * @generated
	 * @ordered
	 */
	protected UcmActivity ucmActivity;

	/**
	 * The default value of the '{@link #getFilePath() <em>File Path</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFilePath()
	 * @generated
	 * @ordered
	 */
	protected static final String FILE_PATH_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getFilePath() <em>File Path</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFilePath()
	 * @generated
	 * @ordered
	 */
	protected String filePath = FILE_PATH_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RevisionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.REVISION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getRevisionFilePath() {
		return revisionFilePath;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRevisionFilePath(String newRevisionFilePath) {
		String oldRevisionFilePath = revisionFilePath;
		revisionFilePath = newRevisionFilePath;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.REVISION__REVISION_FILE_PATH, oldRevisionFilePath, revisionFilePath));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getRevisionNumber() {
		return revisionNumber;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRevisionNumber(int newRevisionNumber) {
		int oldRevisionNumber = revisionNumber;
		revisionNumber = newRevisionNumber;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.REVISION__REVISION_NUMBER, oldRevisionNumber, revisionNumber));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DiffReport getDiffReport() {
		if (diffReport != null && diffReport.eIsProxy()) {
			InternalEObject oldDiffReport = (InternalEObject)diffReport;
			diffReport = (DiffReport)eResolveProxy(oldDiffReport);
			if (diffReport != oldDiffReport) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.REVISION__DIFF_REPORT, oldDiffReport, diffReport));
			}
		}
		return diffReport;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DiffReport basicGetDiffReport() {
		return diffReport;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDiffReport(DiffReport newDiffReport) {
		DiffReport oldDiffReport = diffReport;
		diffReport = newDiffReport;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.REVISION__DIFF_REPORT, oldDiffReport, diffReport));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getStream() {
		return stream;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setStream(String newStream) {
		String oldStream = stream;
		stream = newStream;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.REVISION__STREAM, oldStream, stream));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UcmActivity getUcmActivity() {
		if (ucmActivity != null && ucmActivity.eIsProxy()) {
			InternalEObject oldUcmActivity = (InternalEObject)ucmActivity;
			ucmActivity = (UcmActivity)eResolveProxy(oldUcmActivity);
			if (ucmActivity != oldUcmActivity) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.REVISION__UCM_ACTIVITY, oldUcmActivity, ucmActivity));
			}
		}
		return ucmActivity;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UcmActivity basicGetUcmActivity() {
		return ucmActivity;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setUcmActivity(UcmActivity newUcmActivity) {
		UcmActivity oldUcmActivity = ucmActivity;
		ucmActivity = newUcmActivity;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.REVISION__UCM_ACTIVITY, oldUcmActivity, ucmActivity));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getFilePath() {
		return filePath;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setFilePath(String newFilePath) {
		String oldFilePath = filePath;
		filePath = newFilePath;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.REVISION__FILE_PATH, oldFilePath, filePath));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.REVISION__REVISION_FILE_PATH:
				return getRevisionFilePath();
			case ModelPackage.REVISION__REVISION_NUMBER:
				return getRevisionNumber();
			case ModelPackage.REVISION__DIFF_REPORT:
				if (resolve) return getDiffReport();
				return basicGetDiffReport();
			case ModelPackage.REVISION__STREAM:
				return getStream();
			case ModelPackage.REVISION__UCM_ACTIVITY:
				if (resolve) return getUcmActivity();
				return basicGetUcmActivity();
			case ModelPackage.REVISION__FILE_PATH:
				return getFilePath();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.REVISION__REVISION_FILE_PATH:
				setRevisionFilePath((String)newValue);
				return;
			case ModelPackage.REVISION__REVISION_NUMBER:
				setRevisionNumber((Integer)newValue);
				return;
			case ModelPackage.REVISION__DIFF_REPORT:
				setDiffReport((DiffReport)newValue);
				return;
			case ModelPackage.REVISION__STREAM:
				setStream((String)newValue);
				return;
			case ModelPackage.REVISION__UCM_ACTIVITY:
				setUcmActivity((UcmActivity)newValue);
				return;
			case ModelPackage.REVISION__FILE_PATH:
				setFilePath((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.REVISION__REVISION_FILE_PATH:
				setRevisionFilePath(REVISION_FILE_PATH_EDEFAULT);
				return;
			case ModelPackage.REVISION__REVISION_NUMBER:
				setRevisionNumber(REVISION_NUMBER_EDEFAULT);
				return;
			case ModelPackage.REVISION__DIFF_REPORT:
				setDiffReport((DiffReport)null);
				return;
			case ModelPackage.REVISION__STREAM:
				setStream(STREAM_EDEFAULT);
				return;
			case ModelPackage.REVISION__UCM_ACTIVITY:
				setUcmActivity((UcmActivity)null);
				return;
			case ModelPackage.REVISION__FILE_PATH:
				setFilePath(FILE_PATH_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.REVISION__REVISION_FILE_PATH:
				return REVISION_FILE_PATH_EDEFAULT == null ? revisionFilePath != null : !REVISION_FILE_PATH_EDEFAULT.equals(revisionFilePath);
			case ModelPackage.REVISION__REVISION_NUMBER:
				return revisionNumber != REVISION_NUMBER_EDEFAULT;
			case ModelPackage.REVISION__DIFF_REPORT:
				return diffReport != null;
			case ModelPackage.REVISION__STREAM:
				return STREAM_EDEFAULT == null ? stream != null : !STREAM_EDEFAULT.equals(stream);
			case ModelPackage.REVISION__UCM_ACTIVITY:
				return ucmActivity != null;
			case ModelPackage.REVISION__FILE_PATH:
				return FILE_PATH_EDEFAULT == null ? filePath != null : !FILE_PATH_EDEFAULT.equals(filePath);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (revisionFilePath: ");
		result.append(revisionFilePath);
		result.append(", revisionNumber: ");
		result.append(revisionNumber);
		result.append(", stream: ");
		result.append(stream);
		result.append(", filePath: ");
		result.append(filePath);
		result.append(')');
		return result.toString();
	}

} //RevisionImpl
